package com.cyt.wx.model.po;

import com.cyt.base.util.BaseUtil;
import com.cyt.base.util.DictCode;
import com.cyt.sys.model.po.SysUser;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 微信端-会员管理实体类
 *
 * @author caideyong
 * @date 2019-7-9 8:37:55
 */
@Data
@NoArgsConstructor
@Table(name = "cyt_wx_member")
public class WxMember implements Serializable {

    /**
     * id
     */
    @Id
    private String id;

    /**
     * 微信openid
     */
    @Column(name = "openid")
    private String openid;

    /**
     * 微信头像
     */
    @Column(name = "head_logo")
    private String headLogo;

    /**
     * 微信昵称
     */
    @Column(name = "nick_name")
    private String nickName;

    /**
     * 有效标识
     */
    @Column(name = "token")
    private String token;

    /**
     * token失效时间
     */
    @Column(name = "token_end_time")
    private Date tokenEndTime;

    /**
     * 应用id
     */
    @Column(name = "apply_id")
    private String applyId;

    /**
     * 删除标志
     */
    @Column(name = "remove_tag")
    private String removeTag;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 创建人
     */
    @Column(name = "create_user")
    private String createUser;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    /**
     * 更新人
     */
    @Column(name = "update_user")
    private String updateUser;

    @Transient
    private String applyName;

    @Transient
    private String userId;

    @Transient
    private String userName;

    @Transient
    private String creatorName;

    /**
     * 创建对象
     *
     * @param sysUser 当前用户信息
     * @author caideyong
     * @date 2019-7-9 8:37:55
     */
    public WxMember(SysUser sysUser) {
        this.id = BaseUtil.uId();
        this.removeTag = DictCode.BASE_REMOVE_TAG_NORMAL;
        this.createTime = new Date();
        this.createUser = sysUser.getId();
        this.updateTime = new Date();
        this.updateUser = sysUser.getId();
    }
}